package com.snowcattle.future;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;

/**
 *
 */
public interface ITaskFuture<V> extends Future<V> {

    boolean isSuccess(); //是否成功

    V getNow(); //获取执行结果

    boolean isCancellable(); //是否可以取消

    ITaskFuture<V> await() throws InterruptedException, ExecutionException;//等待future完成

    boolean await(long timeOutMills) throws InterruptedException; //等待future超时完

    boolean await(long timeOut, TimeUnit timeUnit) throws InterruptedException; //等待future超时完成

    ITaskFuture<V> awaitUninterruptibly() throws Exception;   //等待future完成，不相应中断

    boolean awaitUninterruptibly(long timeOutMills);

    boolean awaitUninterruptibly(long timeOut, TimeUnit timeUnit);

    ITaskFuture<V> addListener(ITaskFutureListener listener);

    ITaskFuture<V> removeListener(ITaskFuture<V> listener);

}
